-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further refactor MYSQL_PROXY #119
Conversation
@@ -34,7 +34,7 @@ | |||
|
|||
#include "connection_handler.h" | |||
#include "driver.h" | |||
#include "mysql_proxy.h" | |||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: includes are no longer in alphabetical order.
#include "failover.h" | ||
#include "mysql_proxy.h" | ||
#include "util/installer.h" | ||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: likewise
driver/efm_proxy.h
Outdated
#include "monitor_service.h" | ||
#include "mysql_proxy.h" | ||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: likewise
driver/failover.h
Outdated
@@ -33,23 +33,20 @@ | |||
#include "connection_handler.h" | |||
#include "topology_service.h" | |||
#include "mylog.h" | |||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: likewise
driver/monitor.cc
Outdated
@@ -33,7 +33,7 @@ | |||
|
|||
#include "monitor_service.h" | |||
#include "mylog.h" | |||
#include "mysql_proxy.h" | |||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: likewise
driver/mysql_proxy.h
Outdated
#include "host_info.h" | ||
#include "connection_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: likewise
|
||
if (new_connection->is_connected()) { | ||
dbc->close(); | ||
dbc->mysql_proxy->set_connection(new_connection); | ||
dbc->connection_proxy->set_connection(new_connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a bit unclear on the point of this set_connection()
? Is it just for updating the underlying raw MYSQL*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, move the underlying MYSQL*
from new_connection
to dbc->connection_proxy
driver/efm_proxy.cc
Outdated
void EFM_PROXY::set_connection(MYSQL_PROXY* mysql_proxy) { | ||
next_proxy->set_connection(mysql_proxy); | ||
void EFM_PROXY::set_connection(CONNECTION_PROXY* connection_proxy) { | ||
next_proxy->set_connection(connection_proxy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? It looks like the same as the method it's overriding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to call parent implementation.
|
||
void set_next_proxy(MYSQL_PROXY* next_proxy) override; | ||
void set_connection(CONNECTION_PROXY* connection_proxy) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EFM_PROXY::set_connection()
does override CONNECTION_PROXY::set_connection()
, it calls monitor_service->stop_monitoring_for_all_connections(node_keys)
and generate_node_keys()
@@ -48,6 +48,9 @@ | |||
****************************************************************************/ | |||
|
|||
#include "driver.h" | |||
#include "mysql_proxy.h" | |||
#include "efm_proxy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: includes not in alphabetical order.
Added 08007 for Connection failure during transaction
* create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order
Added 08007 for Connection failure during transaction
* create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order
* create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order
* create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order
* Add AWS Authentication parameters to DSN UI (#115) * Refactor MYSQL_PROXY (#118) * EFM PROXY * complete EFM PROXY * fix unit tests * fix include * generate node keys after setting next proxy for EFM_PROXY * fix unit tests * stop monitoring init() and options() * replace MYSQL_MONITOR_PROXY with MYSQL_PROXY * fix unit tests * stop monitoring ping() * stop monitoring ssl_set and option4 * stop monitoring autocommit * comment out aws code * stop monitoring client_find_plugin * newline at eof * free monitor connection before getting a new one * fix unit tests * test * disable failover and monitoring for monitor thread * fix memory leak in unit test * needs connection handler for monitor * add null check in monitor service start monitoring * fix env handle still used after deleting * comment out mysql_library_init * move connection handler to its own header file * Further refactor MYSQL_PROXY (#119) * create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order * AWS SDK helper class (#123) * Implement IAM Authentication (#120) * Add Authentication Parameters to ConnectionStringBuilder (#124) * Secrets Manager Proxy (#121) * new secrets_manager files * working secrets manager client * add cache for secrets manager proxy * first unit test for secrets manager proxy * added more unit tests * fix unique lock missing template arguments * fix multiple calls to aws api in secrets manager unit tests * fix multiple aws init/shutdown api calls in integration tests * fix calling init/shutdownApi in windows * verbose log for windows community tests * wrap initapi and shutdownapi inside secrets manager proxy contructor/destructor * move init/shutdown aws api to alloc/free env handle * move init/shutdown aws api to alloc/free env handle * test * test * fix static variables * fix atomic int init * fix unit tests * renaming * cleanup * introduce aws sdk helpoer * address comments * nit * fix rebase * fix rebase * set error * fix build * better error message * Secrets manager integration test (#127) * create secrets in java util * simple sm test * simplify setup * fix integration * comment out toxiporxy * comment out toxiporxy * sm test not inherit from base anymore * fix build * fix set error message, fix dsn not picked up * add {} in connection string * fix curly braces * fix log * fix build * more logging * more logging * fix test * better error handling * uncomment * address comments * revert * IAM Authentication Integration Tests (#126) * Refactor Integration Tests (#128) * Fix installer (#129) * fix minor version exceeding 255, remove lib folder for installer * remove setup lib from installer * add aws sdk component in wix * build aws sdk on release action * workflow dispatch * bundle aws sdk when doing cpack on mac and linux * fix mac installer aws dependencies * Adjust DSN config UI for AWS Authentication (#130) * Documentation for AWS Authentication (#131) * rename windows installer (#132) * Update license (#133) * update license * ignore file change in license * update license in build script * Parse Region from Secret if User does not provide Region (#134) * Fix SQLCancel not going through proxy (#135) * fix SQLCancel not going through proxy * cleanup ds during dbc clone * spacing * Fix typo in doc * Implement ENABLE_STRICT_READER_FAILOVER user parameter (#136) * Override change_user() in IAM/Secrets Manager proxy (#137) * override change_user() in IAM/Secrets Manager proxy * better naming * Fix failover timeout not obeyed (#138) * replace async future with packed_task and thread to avoid blocking future destructor * fix unit tests * add template arguments for std::packaged_task * missing template arguments * use thread pool to run failover and wait for all when driver unloads, fix logger * increase thread pool size * fix reader failover where failed result overwrite successful result * not stop thread pool on free env handle * redirect maven central and stop thread pool in teardown * maven central * add thread id to logs * move future valid check before wait for * move future valid check before wait_for() for writer failover * mark logger as extern * test diable logs * test failover_integration_test first * test * debug gh action * make env var available for debug session * debug in docker * refactor integration tests to use shared pointer for rds client * make rds client back to non static * fix build * reset rds client in teardown * Revert "refactor integration tests to use shared pointer for rds client" This reverts commit 2ec1ae5. * disable remote debug * fix build * debug * specifically call thread pool stop in myodbc_end * move failover thread pool inside env * fix unit test * fix build * cleanup * China endpoint support (#140) * china endpoint support * nit * Verify Writer Cluster Connections (#139) * Fix shadowing member variables causing null pointer exception (#148) * fix some shadowing member variables casuing null pointer exception * extend perf tests aws credentials duration from 3 to 4 hours * workaround mysqlclient * fix zlib not found * fix mac build * bump mysql version * fix mac build * bump github action runner macos versiooon * update download link * fix build * install openssl1.1 for macos13 * debug * debug * fall back to macos 11 * change macos version to 12 * fix build * fix build * Fix monitor timeout (#149) * fix monitor timeout * fix login timeout and unit tests * pass monitor flag * rename a component that may have name collision issue on mac (#151) * Remove is_multi_writer flag and check for last updated writer * Fix tests * Remove uneeded line --------- Co-authored-by: justing-bq <62349012+justing-bq@users.noreply.github.com> Co-authored-by: Yan Wang <68562925+yanw-bq@users.noreply.github.com> Co-authored-by: justing-bq <justing@bitquilltech.com> Co-authored-by: Alex Rehnby-Martin <alexr@AlexRsMacbookPro.local>
* create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order
* Add AWS Authentication parameters to DSN UI (#115) * Refactor MYSQL_PROXY (#118) * EFM PROXY * complete EFM PROXY * fix unit tests * fix include * generate node keys after setting next proxy for EFM_PROXY * fix unit tests * stop monitoring init() and options() * replace MYSQL_MONITOR_PROXY with MYSQL_PROXY * fix unit tests * stop monitoring ping() * stop monitoring ssl_set and option4 * stop monitoring autocommit * comment out aws code * stop monitoring client_find_plugin * newline at eof * free monitor connection before getting a new one * fix unit tests * test * disable failover and monitoring for monitor thread * fix memory leak in unit test * needs connection handler for monitor * add null check in monitor service start monitoring * fix env handle still used after deleting * comment out mysql_library_init * move connection handler to its own header file * Further refactor MYSQL_PROXY (#119) * create DUMMY_PROXY to handle mysql library calls, refactor MYSQL_PROXY to only forward proxy call * remove commented include * include thread header in dummy proxy * rename mysql_proxy to connection_proxy * rename dummy proxy to mysql proxy * remove secrets manager proxy as it should be a different PR * include in alphabetical order * AWS SDK helper class (#123) * Implement IAM Authentication (#120) * Add Authentication Parameters to ConnectionStringBuilder (#124) * Secrets Manager Proxy (#121) * new secrets_manager files * working secrets manager client * add cache for secrets manager proxy * first unit test for secrets manager proxy * added more unit tests * fix unique lock missing template arguments * fix multiple calls to aws api in secrets manager unit tests * fix multiple aws init/shutdown api calls in integration tests * fix calling init/shutdownApi in windows * verbose log for windows community tests * wrap initapi and shutdownapi inside secrets manager proxy contructor/destructor * move init/shutdown aws api to alloc/free env handle * move init/shutdown aws api to alloc/free env handle * test * test * fix static variables * fix atomic int init * fix unit tests * renaming * cleanup * introduce aws sdk helpoer * address comments * nit * fix rebase * fix rebase * set error * fix build * better error message * Secrets manager integration test (#127) * create secrets in java util * simple sm test * simplify setup * fix integration * comment out toxiporxy * comment out toxiporxy * sm test not inherit from base anymore * fix build * fix set error message, fix dsn not picked up * add {} in connection string * fix curly braces * fix log * fix build * more logging * more logging * fix test * better error handling * uncomment * address comments * revert * IAM Authentication Integration Tests (#126) * Refactor Integration Tests (#128) * Fix installer (#129) * fix minor version exceeding 255, remove lib folder for installer * remove setup lib from installer * add aws sdk component in wix * build aws sdk on release action * workflow dispatch * bundle aws sdk when doing cpack on mac and linux * fix mac installer aws dependencies * Adjust DSN config UI for AWS Authentication (#130) * Documentation for AWS Authentication (#131) * rename windows installer (#132) * Update license (#133) * update license * ignore file change in license * update license in build script * Parse Region from Secret if User does not provide Region (#134) * Fix SQLCancel not going through proxy (#135) * fix SQLCancel not going through proxy * cleanup ds during dbc clone * spacing * Fix typo in doc * Implement ENABLE_STRICT_READER_FAILOVER user parameter (#136) * Override change_user() in IAM/Secrets Manager proxy (#137) * override change_user() in IAM/Secrets Manager proxy * better naming * Fix failover timeout not obeyed (#138) * replace async future with packed_task and thread to avoid blocking future destructor * fix unit tests * add template arguments for std::packaged_task * missing template arguments * use thread pool to run failover and wait for all when driver unloads, fix logger * increase thread pool size * fix reader failover where failed result overwrite successful result * not stop thread pool on free env handle * redirect maven central and stop thread pool in teardown * maven central * add thread id to logs * move future valid check before wait for * move future valid check before wait_for() for writer failover * mark logger as extern * test diable logs * test failover_integration_test first * test * debug gh action * make env var available for debug session * debug in docker * refactor integration tests to use shared pointer for rds client * make rds client back to non static * fix build * reset rds client in teardown * Revert "refactor integration tests to use shared pointer for rds client" This reverts commit 2ec1ae5. * disable remote debug * fix build * debug * specifically call thread pool stop in myodbc_end * move failover thread pool inside env * fix unit test * fix build * cleanup * China endpoint support (#140) * china endpoint support * nit * Verify Writer Cluster Connections (#139) * Fix shadowing member variables causing null pointer exception (#148) * fix some shadowing member variables casuing null pointer exception * extend perf tests aws credentials duration from 3 to 4 hours * workaround mysqlclient * fix zlib not found * fix mac build * bump mysql version * fix mac build * bump github action runner macos versiooon * update download link * fix build * install openssl1.1 for macos13 * debug * debug * fall back to macos 11 * change macos version to 12 * fix build * fix build * Fix monitor timeout (#149) * fix monitor timeout * fix login timeout and unit tests * pass monitor flag * rename a component that may have name collision issue on mac (#151) * Remove is_multi_writer flag and check for last updated writer * Fix tests * Remove uneeded line --------- Co-authored-by: justing-bq <62349012+justing-bq@users.noreply.github.com> Co-authored-by: Yan Wang <68562925+yanw-bq@users.noreply.github.com> Co-authored-by: justing-bq <justing@bitquilltech.com> Co-authored-by: Alex Rehnby-Martin <alexr@AlexRsMacbookPro.local>
Review Status
Summary
Create
DUMMY_PROXY
to handle MySQL library calls, refactorMYSQL_PROXY
to only redirect proxy call.Additional Reviewers
@justing-bq @sergiyvamz